﻿<%@ Control Language="VB" AutoEventWireup="false" CodeFile="Create.ascx.vb" Inherits="Control_Store_Create" %>
<%@ Register Assembly="ValidationDropdownlist" Namespace="ValidationDropdownlist.CustomControls"
    TagPrefix="cc2" %>
<%@ Register Assembly="ValidationTextBox" Namespace="ValidationTextBox.CustomControls"
    TagPrefix="cc1" %>
<%@ Register Assembly="CuteEditor" Namespace="CuteEditor" TagPrefix="CE" %>
<script type="text/javascript">
    function ajaxJquery() {
        $(document).ready(function () {
            $("#<%= btnSave.ClientID %>").click(function () {

                if (validateFormInputs() == true) {

                    if (getAllImages() == true) {

                        return true;
                    } else {
                        return false;
                    };
                } else {
                    return false;
                };
            });



            $(".ItemDisabled").attr("disabled", "true");
            $(".TextBox:first").focus();
            //Upload Image
            $('#file_upload').uploadify({
                'uploader': '<%=ResolveUrl("~/uploadify/uploadify.swf")%>',
                'script': '<%=ResolveUrl("~/uploadify/UploadStore.ashx?folder=ImageStorage")%>',
                'cancelImg': '<%=ResolveUrl("~/uploadify/cancel.png")%>',
                'folder': '<%=ResolveUrl("~/Uploads")%>',
                'auto': false,
                'multi': false,
                'fileExt': '*.jpg;*.gif;*.png',
                'fileDesc': 'Web Image Files (.JPG, .GIF, .PNG)',
                'fileDataName': 'myfile',
                'sizeLimit': '<%= ConfigurationManager.AppSettings("maxupload") %>',
                'onComplete': function (event, ID, fileObj, response, data) {
                    $('#<%=hidImagePath.ClientID %>').val('<%= ConfigurationManager.AppSettings("ImageDomain") %>' + response);
                    $('#<%=imgUpload.ClientID %>').attr("src", '<%= ConfigurationManager.AppSettings("ImageDomain") %>' + response);
                }
            });

            //Upload Album 
            var str = "";
            $('#fileAlbum').uploadify({
                'uploader': '<%=ResolveUrl("~/uploadify/uploadify.swf")%>',
                'script': '<%=ResolveUrl("~/uploadify/UploadAlbum.ashx?folder=ImageStorage")%>',
                'cancelImg': '<%=ResolveUrl("~/uploadify/cancel.png")%>',
                'folder': '<%=ResolveUrl("~/Uploads")%>',
                'auto': false,
                'multi': true,
                'fileExt': '*.jpg;*.gif;*.png;*.jpeg;*.bmp',
                'fileDesc': 'Web Image Files (.JPG, .GIF, .PNG , .JPEG , .BMP)',
                'fileDataName': 'fileAlbum',
                'sizeLimit': 10240000,
                'onComplete': function (event, ID, fileObj, response, data) {
                    str += '<%= ConfigurationManager.AppSettings("ImageDomain") %>' + response.toString();
                },
                'onAllComplete': function (event, data) {
                    str += "0";
                    var myAlbum = new Array();
                    myAlbum = str.split(",");
                    str = "";
                    for (var i = 0; i < myAlbum.length - 1; i++) {
                        var index = 0;
                        index = Math.floor(Math.random() * 100);
                        $(".GridBorder").append("<tr id='" + index + "' ><td Width='10%' class='text_list_links' align='center' > <a  class='delbutton' style='cursor:pointer;' onclick='RemoveRow(" + index + ");' > Xóa </a> </td> <td Width='20%' class='text_list_links' align='left' > <img alt=''   src='" + myAlbum[i] + "' Style='width: 100px; height: 68px; top: 0px; left: 0px;' class='ag-Jd-Pd' /> </td><td Width='20%' class='text_list_links' align='left' ><textarea id='TextArea1' cols='15' rows='4'></textarea></td></tr>");
                    }
                }
            });

            //Upload Image bigbanner
            $('#file_upload_bigbanner').uploadify({
                'uploader': '<%=ResolveUrl("~/uploadify/uploadify.swf")%>',
                'script': '<%=ResolveUrl("~/uploadify/Upload.ashx?folder=ImageStorage")%>',
                'cancelImg': '<%=ResolveUrl("~/uploadify/cancel.png")%>',
                'folder': '<%=ResolveUrl("~/Uploads")%>',
                'auto': false,
                'multi': false,
                'fileExt': '*.jpg;*.gif;*.png',
                'fileDesc': 'Web Image Files (.JPG, .GIF, .PNG)',
                'fileDataName': 'myfile',
                'sizeLimit': '<%= ConfigurationManager.AppSettings("maxupload") %>',
                'onComplete': function (event, ID, fileObj, response, data) {
                    $('#<%=hidImagePathBigbanner.ClientID %>').val('<%= ConfigurationManager.AppSettings("ImageDomain") %>' + response);
                    $('#<%=imgUpload_bigbanner.ClientID %>').attr("src", '<%= ConfigurationManager.AppSettings("ImageDomain") %>' + response);
                }
            });



        });
    }


    function RemoveRow(i) {
        $(".GridBorder #" + i).remove();

    }
    function showImage(i, title, desc) {
        $(".GridBorder").append("<tr id='" + i + "' ><td Width='10%' class='text_list_links' align='center' > <a  class='delbutton' style='cursor:pointer;' onclick='RemoveRow(" + i + ");' > Xóa </a> </td> <td Width='20%' class='text_list_links' align='left' > <img alt=''   src='" + title + "' Style='width: 100px; height: 68px; top: 0px; left: 0px;' class='ag-Jd-Pd' /> </td><td Width='20%' class='text_list_links' align='left' ><textarea id='TextArea1' cols='15' rows='4'>" + desc + "</textarea></td></tr>");
    }

    function getAllImages() {
        var strImage = "";
        var strComment = "";
        $(".GridBorder tr td img").each(function (e) {
            strImage += $(this).attr("src") + ","
        });
        $(".GridBorder tr td textarea").each(function (e) {
            strComment += $(this).val() + ";"
        });
        $("#<%=hidStrImage.ClientID()%>").val(strImage + '0');
        $("#<%=hidStrCommnet.ClientID()%>").val(strComment + '0');
        return true;
    }
</script>
<asp:UpdatePanel ID="uplStore" runat="server">
    <ContentTemplate>
        <div class="content_porletform">
            <div class="HeadTitle">
                <h3>
                    <asp:Label ID="Label3" runat="server" Text=" THÊM SHOP" /></h3>
            </div>
            <div class="box_contentform">
                <div class="box_scroll_grid">
                    <div class="DivRequired">
                        <span class="fieldRequired">&nbsp;</span>Trường yêu cầu nhập dữ liệu
                    </div>
                    <div class="Error">
                    </div>
                    <div class="DivRow">
                        <div class="DivLabel">
                            <asp:Label ID="Label9" CssClass="TextLabel" runat="server" Text="Người dùng:" /><span
                                class="fieldRequired">&nbsp;</span>
                        </div>
                        <div class="DivTextBox">
                            <cc2:ValidationDropdownlist ID="ddlNguoiDung" DataType="required" AssociatedLableText="tiêu đề"
                                CssClass="TextBox" runat="server" Width="250px" />
                        </div>
                    </div>
                    <div class="DivRow">
                        <div class="DivLabel">
                            <asp:Label ID="Label12" CssClass="TextLabel" runat="server" Text="VIP SHOP:" />
                        </div>
                        <div class="DivTextBox">
                            <asp:CheckBox ID="chkVIP" runat="server" />
                        </div>
                    </div>
                    <div class="DivRow">
                        <div class="DivLabel">
                            <asp:Label ID="Label11" CssClass="TextLabel" runat="server" Text="Loại hình dinh doanh:" />
                        </div>
                        <div class="DivTextBox">
                            <div class="DivTextBox" style="display: none">
                                <asp:CheckBox ID="chkXeCu" runat="server" />
                                Xe cũ
                                <asp:CheckBox ID="chkXeMoi" runat="server" />
                                Xe mới
                            </div>
                            <asp:TreeView ID="trvMenu" runat="server" CssClass="tree" LineImagesFolder="~/TreeLineImages"
                                ShowCheckBoxes="All" ShowLines="True" Style="margin-left: 170px">
                            </asp:TreeView>
                        </div>
                    </div>
                    <div class="DivRow">
                        <div class="DivLabel">
                        </div>
                        <div class="DivLabel">
                        </div>
                    </div>
                    <div class="DivRow">
                        <div class="DivLabel">
                            <asp:Label ID="lblTitle" CssClass="TextLabel" runat="server" Text="Tiêu đề:" /><span
                                class="fieldRequired">&nbsp;</span>
                        </div>
                        <div class="DivTextBox">
                            <cc1:ValidationTextBox ID="txtTitle" DataType="required" AssociatedLableText="tiêu đề"
                                CssClass="TextBox" runat="server" Text="" Width="250px" />
                        </div>
                    </div>
                    <div class="DivRow">
                        <div class="DivLabel">
                            <asp:Label ID="Labeld2" CssClass="TextLabel" runat="server" Text="Ảnh Header (980px x110) :" />
                        </div>
                        <div class="DivTextBox">
                            <input id="file_upload_bigbanner" name="file_upload" type="file" /><a id="upload_bigbanner"
                                href="javascript:$('#file_upload_bigbanner').uploadifyUpload();">Upload Files</a>
                        </div>
                    </div>
                    <div class="DivRow">
                        <div class="DivLabel">
                            &nbsp;</div>
                        <div style="height: 100px;" class="DivTextBox">
                            <asp:Image ID="imgUpload_bigbanner" runat="server" BorderWidth="0px" Height="100px"
                                Width="100px" ImageUrl="~/Images/NoPhotoAvailable.jpg" />
                        </div>
                    </div>
                    <div class="DivRow">
                        <div class="DivLabel">
                            <asp:Label ID="lblDescription" CssClass="TextLabel" runat="server" Text="Mô tả:" />
                        </div>
                        <div class="DivTextBox">
                            <CE:Editor ID="txtDescription" runat="server" Width="100%" Height="500" EditorWysiwygModeCss="~/example.css">
                                <FrameStyle BackColor="White" BorderColor="#DDDDDD" BorderStyle="Solid" BorderWidth="1px"
                                    CssClass="CuteEditorFrame" Height="100%" Width="100%" />
                            </CE:Editor>
                        </div>
                    </div>
                    <div class="DivRow">
                        <div class="DivLabel">
                            <asp:Label ID="lblContactus" CssClass="TextLabel" runat="server" Text="Liên hệ:" /><span
                                class="fieldRequired">&nbsp;</span>
                        </div>
                        <div class="DivTextBox">
                            <CE:Editor ID="txtContactus" runat="server" Width="100%" Height="500" EditorWysiwygModeCss="~/example.css">
                                <FrameStyle BackColor="White" BorderColor="#DDDDDD" BorderStyle="Solid" BorderWidth="1px"
                                    CssClass="CuteEditorFrame" Height="100%" Width="100%" />
                            </CE:Editor>
                        </div>
                    </div>
                    <div class="DivRow">
                        <div class="DivLabel">
                            <asp:Label ID="Label13" CssClass="TextLabel" runat="server" Text="Bản đồ:" />
                        </div>
                        <div class="DivTextBox">
                            <asp:TextBox ID="txtMap" runat="server" TextMode="MultiLine" Rows="5" Width="400px"
                                CssClass="TextArea" />
                        </div>
                    </div>
                    <div class="DivRow">
                        <div class="DivLabel">
                            <asp:Label ID="lblUrlweb" CssClass="TextLabel" runat="server" Text="Urlweb:" />
                        </div>
                        <div class="DivTextBox">
                            <cc1:ValidationTextBox ID="txtUrlweb" DataType="custom" CustomPattern="UrlWeb" AssociatedLableText="web"
                                CssClass="TextBox" runat="server" Text="" />
                        </div>
                    </div>
                    <div class="DivRow">
                        <div class="DivLabel">
                            <asp:Label ID="lblEmail" CssClass="TextLabel" runat="server" Text="Email:" />
                        </div>
                        <div class="DivTextBox">
                            <cc1:ValidationTextBox ID="txtEmail" DataType="custom" CustomPattern="Email" AssociatedLableText="email"
                                CssClass="TextBox" runat="server" Text="" />
                        </div>
                    </div>
                    <div class="DivRow">
                        <div class="DivLabel">
                            <asp:Label ID="Label1" CssClass="TextLabel" runat="server" Text="Logo:" />
                        </div>
                        <div class="DivTextBox">
                            <input id="file_upload" name="file_upload" type="file" /><a id="upload" href="javascript:$('#file_upload').uploadifyUpload();">Upload
                                Files</a>
                        </div>
                    </div>
                    <div class="DivRow">
                        <div class="DivLabel">
                            &nbsp;</div>
                        <div style="height: 100px;" class="DivTextBox">
                            <asp:Image ID="imgUpload" runat="server" BorderWidth="0px" Height="100px" Width="100px"
                                ImageUrl="~/Images/NoPhotoAvailable.jpg" />
                        </div>
                    </div>
                    <div class="DivRow">
                        <div class="DivLabel">
                            <asp:Label ID="Label2" CssClass="TextLabel" runat="server" Text="Album ảnh:" />
                        </div>
                        <div class="DivTextBox" style="text-align: left; padding-left: 178px">
                            <input id="fileAlbum" name="fileAlbum" type="file" />
                            <a href="javascript:$('#fileAlbum').uploadifyUpload();">Upload Files</a>
                        </div>
                    </div>
                    <div class="DivRow">
                        <div class="DivLabel">
                            &nbsp;</div>
                        <div class="DivTextBox">
                            <table cellpadding="0" width="50%" cellspacing="0" border="1" class="GridBorder">
                                <tr>
                                    <td width='10%' class='text_list_links' align='center'>
                                    </td>
                                    <td width='20%' class='text_list_links' align='left'>
                                        Ảnh
                                    </td>
                                    <td width='20%' class='text_list_links' align='left'>
                                        Mô tả
                                    </td>
                                </tr>
                            </table>
                        </div>
                    </div>
                    <div class="DivRow">
                        <div class="DivLabel">
                            <asp:Label ID="lblSkypeid" CssClass="TextLabel" runat="server" Text="Skypeid:" />
                        </div>
                        <div class="DivTextBox">
                            <cc1:ValidationTextBox ID="txtSkypeid" CssClass="TextBox" runat="server" Text="" />
                        </div>
                    </div>
                    <div class="DivRow">
                        <div class="DivLabel">
                            <asp:Label ID="lblSlogan" CssClass="TextLabel" runat="server" Text="Slogan:" />
                        </div>
                        <div class="DivTextBox">
                            <cc1:ValidationTextBox ID="txtSlogan" CssClass="TextBox" runat="server" Text="" />
                        </div>
                    </div>
                    <div class="DivRow">
                        <div class="DivLabel">
                            <asp:Label ID="lblYahooid" CssClass="TextLabel" runat="server" Text="Yahooid:" />
                        </div>
                        <div class="DivTextBox">
                            <cc1:ValidationTextBox ID="txtYahooid" CssClass="TextBox" runat="server" Text="" />
                        </div>
                    </div>
                    <div class="DivRow">
                        <div class="DivLabel">
                            <asp:Label ID="Label4" CssClass="TextLabel" runat="server" Text="Họ và tên:" /><span
                                class="fieldRequired">&nbsp;</span>
                        </div>
                        <div class="DivTextBox">
                            <cc1:ValidationTextBox ID="txtHoTen" DataType="required" AssociatedLableText="họ và tên"
                                CssClass="TextBox" runat="server" Text="" />
                        </div>
                    </div>
                    <div class="DivRow">
                        <div class="DivLabel">
                            <asp:Label ID="Label5" CssClass="TextLabel" runat="server" Text="Điện thoại:" /><span
                                class="fieldRequired">&nbsp;</span>
                        </div>
                        <div class="DivTextBox">
                            <cc1:ValidationTextBox ID="txtPhone" DataType="required" AssociatedLableText="điện thoại"
                                CssClass="TextBox" runat="server" Text="" />
                        </div>
                    </div>
                    <div class="DivRow">
                        <div class="DivLabel">
                            <asp:Label ID="Label6" CssClass="TextLabel" runat="server" Text="Số điện thoại khác:" />
                        </div>
                        <div class="DivTextBox">
                            <cc1:ValidationTextBox ID="txtPhoneOrther" AssociatedLableText="điện thoại" CssClass="TextBox"
                                runat="server" Text="" />
                        </div>
                    </div>
                    <div class="DivRow">
                        <div class="DivLabel">
                            <asp:Label ID="Label7" CssClass="TextLabel" runat="server" Text="Địa chỉ:" /><span
                                class="fieldRequired">&nbsp;</span>
                        </div>
                        <div class="DivTextBox">
                            <cc1:ValidationTextBox ID="txtDiachi" AssociatedLableText="địa chỉ" DataType="required"
                                CssClass="TextBox" runat="server" Text="" />
                        </div>
                    </div>
                    <div class="DivRow">
                        <div class="DivLabel">
                            <asp:Label ID="Label8" CssClass="TextLabel" runat="server" Text="Tỉnh/TP:" /><span
                                class="fieldRequired">&nbsp;</span>
                        </div>
                        <div class="DivTextBox">
                            <cc2:ValidationDropdownlist ID="ddlTinhTP" AssociatedLableText="khu vực" runat="server"
                                CssClass='TextBox' Width="163px" DataType="required">
                            </cc2:ValidationDropdownlist>
                        </div>
                    </div>
                    <div class="DivRow">
                        <div class="DivLabel">
                            &nbsp;&nbsp;&nbsp;</div>
                        <div class="DivTextBox">
                            <asp:Button ID="btnSave" runat="server" Text=" Lưu " CssClass="btn" />
                            <asp:Button ID="btnHuy" CausesValidation="false" runat="server" Text=" Hủy " CssClass="btn" />&nbsp;
                        </div>
                    </div>
                </div>
                <div style="display: none">
                    <asp:HiddenField ID="hidID" Value="0" runat="server" />
                    <asp:TextBox ID="hidImagePath" Text="" runat="server" />
                    <asp:TextBox ID="hidImagePathBigbanner" Text="" runat="server" />
                    <asp:TextBox ID="hidStrImage" Text="" runat="server" />
                    <asp:TextBox ID="hidStrCommnet" Text="" runat="server" />
                </div>
            </div>
        </div>
    </ContentTemplate>
</asp:UpdatePanel>